package com.pedro.streamer.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;


import com.pedro.streamer.R;
import com.pedro.streamer.utils.RecyclerViewSpacesItemDecoration;

import java.util.HashMap;

public class ViewSpecialEffectsListAdapter extends RecyclerView.Adapter<ViewSpecialEffectsListAdapter.TopTabViewHolder> {


    private static final String TAG = "com.bmit.engineermode";

    private Context mContext;


    @Override
    public TopTabViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_special_effects_list_layout, parent, false);
        mContext = parent.getContext();

        return new TopTabViewHolder(view);
    }

    static class TopTabViewHolder extends RecyclerView.ViewHolder {


        TextView textView;
        RecyclerView recyclerView;


        public TopTabViewHolder(View view) {
            //父类构造函数
            super(view);
            textView = view.findViewById(R.id.mark_title);
            recyclerView = view.findViewById(R.id.view_pecial_effects_recycler);



        }

    }

    @Override
    public void onBindViewHolder(@NonNull TopTabViewHolder holder, int position) {

        ViewSpecialEffectsAdapter viewSpecialEffectsAdapter = new ViewSpecialEffectsAdapter();
        HashMap<String, Integer> stringIntegerHashMap = new HashMap<>();
        stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.TOP_DECORATION, 1);
        stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.RIGHT_DECORATION, 1);//左间距


        holder.recyclerView.addItemDecoration(new RecyclerViewSpacesItemDecoration(stringIntegerHashMap));

        GridLayoutManager layoutManager = new GridLayoutManager(mContext, 2);
        layoutManager.setOrientation(RecyclerView.VERTICAL);
        holder.recyclerView.setLayoutManager(layoutManager);
        holder.recyclerView.setAdapter(viewSpecialEffectsAdapter);




        if (position == 0){
            holder.textView.setText("特效滤镜");
        }else {
            holder.textView.setText("画面运镜");
        }




    }






    @Override
    public int getItemCount() {

        return 2;
    }



}
